#include "logger.h"
#include "message.h"

Logger::Logger()
{
    if(!getenv("LOG_LEVEL"))
    {
        m_level=INFO;
    }
    else
    { 
       m_level = LogLevelType[getenv("LOG_LEVEL")];
    }
    m_LogToFile=true;
    m_LogToTerminal=true;
}

void Logger::SetLoToTerminal(bool logToTerminal)
{
    m_LogToTerminal=logToTerminal;
}
bool Logger::GetLoToTerminal()const
{
    return m_LogToTerminal;
}

void Logger::SetLoToLogFile(bool logToLogFile)
{
    m_LogToFile=logToLogFile;
}
bool Logger::GetLoToLogFile()const
{
    return m_LogToFile;
}

void Logger::SetLogLevel(LOG_LEVEL level)
{
    m_level=level;
}
LOG_LEVEL Logger::GetLogLevel()const
{
    return m_level;
}
   

void Logger::SetLogFile(const std::string& logFileName )
{
    if(m_LogFile.is_open())
    {
        m_LogFile.close();
    }
    m_LogFile.open(logFileName);
    m_LogToFile=true;
}



